package com.bgs.service.impl;

import com.bgs.common.R;
import com.bgs.feign.ZeroFeign;
import com.bgs.pojo.ToReport;
import com.bgs.mapper.ToReportMapper;
import com.bgs.pojo.vo.ZeroToReportAndOrderDetail;
import com.bgs.service.ToReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 举报 服务实现类
 * </p>
 *
 * @author Asia
 * @since 2021-09-14
 */
@Service
public class ToReportServiceImpl extends ServiceImpl<ToReportMapper, ToReport> implements ToReportService {
    @Resource
    private ToReportMapper toReportMapper;
    @Autowired
    private ZeroFeign zeroFeign;

    @Override
    public R zeroGetToReportList(ZeroToReportAndOrderDetail zeroToReportAndOrderDetail) {
        List<ZeroToReportAndOrderDetail> zeroToReportAndOrderDetails=toReportMapper.zeroGetToReportList(zeroToReportAndOrderDetail);

        //获取商品id，用来查询店铺，或获取商品，再另一个服务循环
//        zeroToReportAndOrderDetail.getOrderDetail().getStoreId();
       R r= zeroFeign.zeroGetStoreToZeroToReportAndOrderDetail(zeroToReportAndOrderDetails);

//        return R.ok().data("zeroToReportAndOrderDetails",zeroToReportAndOrderDetails);
        return r;
    }

    @Override
    public boolean zeroAddToReport(ToReport toReport) {
        return toReportMapper.zeroAddToReport(toReport);
    }


}
